<?php
namespace api\modules\v1\controllers;
use backend\models\Doctor;
use yii\helpers\ArrayHelper;
use yii\rest\ActiveController;
use yii\filters\auth\HttpBasicAuth;
use yii\data\ActiveDataProvider;
class DoctorController extends ActiveController
{
    public $modelClass = 'backend\models\Doctor';

    public function actions(){
//        var_dump($_GET);//可以获取到从客户端那边传来的数据

        $actions = parent::actions();
        unset($actions['index']);//删除默认方法
        return $actions;
    }

    /**
     * 重新生成数据
     * @return ActiveDataProvider
     */
    public function actionIndex(){

         return  new ActiveDataProvider([
            'query' => Doctor::find(),
            'pagination' => [
                'pageSize' => 3,
            ],
        ]);
    }
}